The unique features of FindGraph are exposed through Automation (formerly called OLE Automation). Through the methods and properties that are exposed, client applications written in Microsoft Visual Basic« or Microsoft Visual C++« can be used to control fitting features of FindGraph.

Properties:

VARIANT ArrayVar
  Array of dimension 3N with points (X, Y, Z) as VARIANT SAFEARRAY.

long ApprParamsNumber
  Number of parameters M

VARIANT ArrayParams
  Array of dimension M

String FuncApprString
  String

long Weighting
  Number

 


Methods

long FuncApprStart(short nFunctionId)
  This prepares the buffer.

long FuncApprEnd()
  You have to call this to free memory

long FuncApprCreate(short nColor, short nWidth, BSTR lpctstrName)
  Creates new curve fit.

double FuncApprInPoint(long dwId, double x)
  Calculates value of function in point x.

double GetApprPara(short num)
  Returns value of parameter.


Sample

To fit your data, follow these steps:

  1.   FuncApprStart(nIdFunc)
        nFunctionId- fitting model identifier.
  2. Use variant array vaPoints. Fill array va[3N] of dimension 3N with data points (X, Y, Z).
        vaPoints = FindGraph.ArrayVar
  3. Use variant array vaParams. Fill array va[M] of dimension M with parameters.
        vaParams = FindGraph.ArrayParams
  4. Fit data and create new curve.
        dwFunc = FuncApprCreate(nColor, nWidth, Name)
  5. Free memory
        FindGraph.FuncApprEnd();
  6. Calculate value of function in point x.
        FuncApprInPoint(dwId, x)

By using Automation, the following sample, written in Visual Basic, demonstrates how to fit your data. See project and testApprVB.exe in directory testApprVB. This runs program FindGraph in new window.


Fitting model identifiers

Regression:
0Polynomial f(U) = a0 + a1*U + a2*U^2 + ...
2Hyperbolic f(U) = a0 + a1/U + a2/U^2 + ...
4Logarithmic f(U) = a0 + a1*ln(U) + a1*ln(U)^2 + ...
6Power ln(f) = a0 + a1*ln(U) + a1*ln(U)^2 + ...
8Exponential ln(f) = a0 + a1*U + a2*U^2 + ...

10Linear Regression

20Piece linear
32B Spline curve
38Parametric curve
50Logistic model
51Gompertz model
60Fourier approximation
70Neural network rational sigmoid
71Neural network exp sigmoid
80User defined function
88Non-linear least-square fitting (predefined function)
90Non-linear least-square fitting (your Formula)

See Fitting Models for details.

Parameters

In all models:
vaParams(0)0 - y=f(x), 1 - x=f(y)

Regression (Polynomial, Hyperbolic, Logarithmic, Power, Exponential):
vaParams(1)Order for regression line or 0

Linear Regression:
vaParams(1)Must be 1
vaParams(2...11)Polynomial, V(U) = V0 + a11*(U-U1)/W1+ a12*((U-U1)/W1)^2 + ..., 
vaParams(2) = U1, vaParams(3) = W1, vaParams(3+i) = 1,  if use a1i
vaParams(12...21)Rational, V(U) =... + a21*W2/(U-U2) + a22*(W2/(U-U2))^2 + ...,
vaParams(12) = U1, vaParams(13) = W1, vaParams(13+i) = 1,  if use a2i
vaParams(22...31)V(U) =... + a31*sqrt(W2/(U-U2)) + a32*sqrt(((U-U2)/W2)) + ...
vaParams(22) = U1, vaParams(23) = W1, vaParams(23+i) = 1,  if use a3i
vaParams(32...41)Logarithmic, V(U) =... + a41*ln (U-U4)/W4 + a42* (ln((U-U4)/W4)^2 + ...
vaParams(32) = U1, vaParams(33) = W1, vaParams(33+i) = 1,  if use a4i
vaParams(42...51) Exponential, V(U) =... + a51*exp(U-U5)/W5 + a52* exp(2*(U-U5)/W5) + ...
vaParams(42) = U1, vaParams(43) = W1, vaParams(43+i) = 1,  if use a5i
vaParams(52...61)Fourier, V(U) =... + a61*sin(U-U6)/W6 + a62* sin(2*(U-U6)/W6) + ...
vaParams(52) = U1, vaParams(53) = W1, vaParams(53+i) = 1,  if use a6i
vaParams(62...71)Polynomial, V(U) = V0 + a11*(U-U1)/W1 + ..., 
V(U) =... + a71*cos(U-U6)/W6 + a72* cos(2*(U-U7)/W6) + ...
See Linear Regression for details.

Piece linear:
vaParams(1)Number of steps
vaParams(2...11)Polynomial

Fourier approximation:
vaParams(1)Number of harmonics

Neural network approximations:
vaParams(1)Number of neurons
vaParams(2)Parameter A
vaParams(3)Step
vaParams(4)Maximum number of iterations

User defined function:
vaParams(1)Unused, must be 1
vaParams(2)Parameter 1
vaParams(3)Parameter 2
vaParams(4)Parameter 3
vaParams(5)Parameter 4
FuncApprStringDLL name in directory "APPR", "POLI_N.DLL" for example

B-Spline curve:
vaParams(1)Unused, must be 1
vaParams(2)Unused, must be 0
vaParams(3)0 - Least squares approximation, 1 - Interpolation
vaParams(4)If 1 - closed curve
vaParams(5)Number of control points: 1-12
vaParams(6)Degree: 1-6

Parametric curve:
vaParams(1)Unused, must be 1
vaParams(2)Center point X value, if 'Fixed center'
vaParams(3)Center point X value
vaParams(4)If 1 - 'Fixed center' is used
vaParams(5)Number of sin(u), cos(u) harmonics: 1-6
vaParams(6)Number of base points: 8-256

Non-linear Fitting:
vaParams(1)Unused, must be 1
vaParams(2)Fitting curve Equation, parabola + sqrt for example
vaParams(3)Fitting Model, polynomial for example
vaParams(4)Step
vaParams(5)Number of Iterations
vaParams(6)Model, 0 - Simplex, 1 - Gradient
vaParams(7)If > 0 - Normalize X
vaParams(8)Initial value of parameter A
vaParams(9)Initial value of parameter B
vaParams(10)Initial value of parameter C
vaParams(11)Initial value of parameter D
vaParams(12)Initial value of parameter G
vaParams(13)If > 0 - Fixed parameter A
vaParams(14)If > 0 - Fixed parameter B
vaParams(15)If > 0 - Fixed parameter C
vaParams(16)If > 0 - Fixed parameter D

Formula: All parameters as for Non-linear Fitting.
FuncApprStringFormula, "a + b*u + c*u*u + d*sin( u )" for example

See Fitting Parameters for details.

Nonlinear Fitting Models

1000Polynomial
2000Exponential
3000Logarithm
4000Power
5000Hyperbola
6000Rational
7000Sigmoidal
8000Peak
9000Waveform
10000Asymptotic

Nonlinear Fitting Equations

Polynomial
1010Const
1020Straight Line
1030Parabola
1040Polynomial4
1050Polynomial5
1060ParabolaSqrt
1070PolynomialSqrt 3
1080PolynomialSqrt 4

Exponential
2010Exponential 1
2020Exponential 2-1
2030Exponential 2-2
2040Exponential 2-3
2050Exponential 2-4
2060Exponential3
2070Stirling
2100Exp Decay 4
2110Exp Decay 5
2120Exp2 Decay 5
2200Exp Growth 3
2210Exp Growth 4
2220Exp2 Growth 5-1
2230Exp2 Growth 5-2
2300Modified Exponential 2
2310Modified Exponential 3
2320Exp and Linear
2330Shah
2340Yeild-fertilizer
2350Vapor Pressure Model
2360Exp Gauss

Logarithm
3010Logarithm 1
3020Logarithm 2-1
3030Logarithm 2-2
3040Logarithm 3
3050Bradley

Power
4010Power Fit
4020Allometric
4030Shifted Power 2
4040Shifted Power 3
4050Shifted Power 4
4060Gamma
4070Geometric
4080Modified Geometric
4100Root Fit
4110Hoerl
4120Freundlich
4130Gunary
4140Langmuir
4150Pareto

Hyperbola
5010Saturation Growth
5020Double Hyperbola
5030Generalized Hyperbola
5040Bent Hyperbola
5050Heat-Capacity Model
5060Inverse

Rational
6010Rational 2
6020Rational 3
6030Rational 4
6040Nelder
6050BET

Sigmoidal
7010Gompertz Model
7020Logistic Model
7030Richards Model
7040Boltzmann
7050Weibull
7060MMF Model
7070Hill
7080Logistic 4

Peak
8010Beta Distribution
8020Extreme
8030Gaussian
8040Log Normal
8050Logistic Peak
8060Lorentz Equation
8070Lorentz Peak
8080Bell
8090Pulse

Waveform
9010Sinusoidal Fit
9020Sine
9030Sine Damp
9040Sine Sqr
9050Truncated Fourier

Asymptotic
10010Asymptotic 1
10020Asymptotic 2-1
10030Asymptotic 2-2
10040Asymptotic 3-1
10050Asymptotic 3-2
10060Monomolecular 3-1
10070Monomolecular 3-2
10080Box Lucas 2-1
10090Box Lucas 2-2
10100Chapman
10110Power Asymptotic 2-1
10120Power Asymptotic 2-2
10200Reciprocal Model
10210Reciprocal Quadratic
10220Reciprocal Logarithm
10230Bleasdale-Nelder3
10240Bleasdale-Nelder4
10250Harris


See documentation on methods and properties.

á